package com.sljy.hzk.room.dao;

import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;

import com.sljy.hzk.entity.UserEntity;

import java.util.List;

/**
 * Created  on 2018/6/27 0027
 *
 * @author 唐开阔
 * @describe
 */
@Dao
public interface UserDao {
    //@Query("SELECT  * FROM UserEntity Limit 1")
    //UserEntity getUser();
    /**
     * 查询所有人员信息
     * */
    @Query("SELECT  * FROM UserEntity")
    List<UserEntity> getUser();

    @Query("SELECT  * FROM UserEntity where isPermanent = 1")
    UserEntity getPermanentUser();

    @Query("SELECT  * FROM UserEntity where accounts = :acc")
    UserEntity getUserFacc(String acc);

    @Query("SELECT  * FROM UserEntity where userId = :userId")
    UserEntity getUserToId(long userId);

    @Delete
    void delete(UserEntity userEntity);
    /**
     * 添加一个数据
     */
    @Insert
    void insert(UserEntity userEntity);

    @Update
    void Update(UserEntity userEntity);
}
